import javax.swing.*;
import java.awt.*;

public class cc {
    public static void main(String[] args) {
        JFrame jf = new JFrame("背景图片测试");
        ImageIcon bg = new ImageIcon("src/images/BJ.jpg");
        JLabel label = new JLabel(bg);
        label.setSize(bg.getIconWidth(),bg.getIconHeight());
        jf.getLayeredPane().add(label,new Integer(Integer.MIN_VALUE));
        JPanel pan = (JPanel)jf.getContentPane();
        pan.setOpaque(false);
        pan.setLayout(new FlowLayout());
        JButton btn = new JButton("测试按钮");
        pan.add(btn);
        jf.setSize(bg.getIconWidth(),bg.getIconHeight());
        jf.setLocationRelativeTo(null);
        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        jf.setVisible(true);


    }
}
